package zy.blue7.im.core.service.impl;


import io.netty.channel.Channel;
import zy.blue7.im.common.message.Message;
import zy.blue7.im.common.message.SingleMessage;
import zy.blue7.im.core.other.Container;
import zy.blue7.im.core.service.MessageHandler;

import java.io.IOException;

/**
 * @author blue7
 * @version 1.0
 * @date 2022/2/28 9:19
 */
public class SingleMessageHandlerImpl implements MessageHandler {
    @Override
    public void handle(Message message, Channel channel) throws IOException {
        System.out.println(message);
        System.out.println(message.getClass());
        System.out.println("SingleMessage....");

        SingleMessage singleMessage = (SingleMessage) message;

        Channel toChannel = Container.map.get(singleMessage.getTo());

        sendMessage(singleMessage, toChannel);

    }
}
